<meta charset="utf-8"/>
<?php
    
    if($_POST["color"]){
    	$color=$_POST["color"];	
    }
    else{
    	$color = 'red';
    }

   
?>
    <body bgcolor="<?php echo $color;?>">

         <form action="" method="post"  >
        选择背景：
        <select name="color" size="">
          <option  value="red">红色</option>
          <option  value="yellow">黄色</option>
          <option  value="blue">蓝色</option>
          <option  value="green">绿色</option>
          <option  value="black">黑色</option>
          <option  value="white">白色</option>
        </select>
        <input type="submit" value="提交">
    </form>

<?php

    if($color == 'red'){
        return  $color;
    }elseif($color == 'yellow'){
    	return $color;
    }elseif($color == 'blue'){
    	return  $color;
    }elseif($color == 'green'){
        return  $color;  
    }elseif($color == 'black'){
        return  $color;
    }else{
    	return  $color;
    }

?>


  

 <?php
 /*
<?php if($color == 'red')echo 'selected = "selected"'; ?>

<?php if($color == 'yellow')echo 'selected = "selected"'; ?>


<?php if($color == 'blue')echo 'selected = "selected"'; ?>

<?php if($color == 'green')echo 'selected = "selected"'; ?>

<?php if($color == 'black')echo 'selected = "selected"'; ?>
<?php if($color == 'white')echo 'selected = "selected"'; ?>

 */